﻿namespace IBTrader.Modules.Binarize
{
    using IBTrader.Modules.Market;
    using System;
    using System.IO;

    class BinarizerDailyTick : Binarizer
    {
        protected override void WriteLine(BinaryWriter writer, string[] parts)
        {
            if (parts.Length != 4) return;// throw new ArgumentException("Invalid length", "parts");

            var cnt = int.Parse(parts[0], ci);
            var dt = DateTime.Parse(parts[1], ci);
            var type = Enum.Parse(typeof(TickType), parts[2]);
            var price = float.Parse(parts[3], ci);

            writer.Write((int)dt.TimeOfDay.TotalSeconds);
            writer.Write(price);
            writer.Write((byte)type);
        }
    }
}